// import Taro from '@tarojs/taro'
import {
    // IS_CARINFO,
    UPDATE_CARINFO
} from './action-types'


interface State {
    carInfo: {
        list: ICar[] | []
        currentCar: ICar | undefined | {}
    }
    // 返回的页面
    routesBack: string
}

const INITIAL_STATE: State = {
    carInfo: {
        list: [],
        currentCar: undefined
    },
    routesBack: ''
}
export default function user(state = INITIAL_STATE, action) {
    switch (action.type) {
        case UPDATE_CARINFO:
            // console.log('action:', action.carInfo)
            return {
                ...state,
                carInfo: action.carInfo
            }
        default:
            return state
    }
}